<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html>
<html>
<head>
<jsp:include page="../inc.jsp"></jsp:include>

<script type="text/javascript" src="../My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript" src="../jslib/date.js"></script>
<script type="text/javascript" charset="utf-8">
	var datagrid;
	$(function() {
	    $('#d4311').val((new Date()).pattern("yyyy-MM-01"));
	    $('#d4312').val((new Date()).pattern("yyyy-MM-dd"));
		datagrid = $('#datagrid').datagrid({
			url : 'salelistAction!datagridTotal.html',
			title : '营业员销售列表',
			iconCls : 'icon-save',
			pagination : true,
			pagePosition : 'bottom',
			pageSize : 10,
			pageList : [ 10, 20, 30, 40 ],
			fit : true,
			fitColumns : false,
			nowrap : false,
			border : false,
			idField : 'id',
			//sortName : 'name',
			//sortOrder : 'desc',
			checkOnSelect : false,
			selectOnCheck : true,
			//frozenColumns : [ [ {
			//	title : '编号',
			//	field : 'id',
			//	width : 150,
			//	sortable : true,
			//	hidden : true
			//} ] ],
			columns : [ [  {
				title : '营业员',
				field : 'uusername',
				width : 150
			}, {
				title : '所属仓库',
				field : 'rname',
				width : 150
			}, {
				title : '开始时间',
				field : 'beginDate',
				width : 150,formatter : function(value, row, index) {
					return value.substring(0,10);
				}
			}, {
				title : '结束时间',
				field : 'endDate',
				width : 150,
				formatter : function(value, row, index) {
					return value.substring(0,10);
				}
			} , {
				title : '销售总额',
				field : 'total',
				width : 150
			}] ],			
			onRowContextMenu : function(e, rowIndex, rowData) {
				e.preventDefault();
				$(this).datagrid('unselectAll');
				$(this).datagrid('selectRow', rowIndex);
				$('#menu').menu('show', {
					left : e.pageX,
					top : e.pageY
				});
			}
		});
		
		var rid = $('#searchForm').find('input[name=rid]');
		var ridCombobox = rid.combobox({
			url : '${pageContext.request.contextPath}/rkgl/repertoryAction!noAuth_combobox.html',
			valueField : 'id',
			textField : 'name',
			multiple : false,
			editable : false,
			panelHeight : 'auto'
		});

	});
	
	function _search() {
		datagrid.datagrid('load', sy.serializeObject($('#searchForm')));
	}
	
	function cleanSearch() {	    
		datagrid.datagrid('load', {});
		$('#searchForm input').val('');
	}
</script>

</head>
<body class="easyui-layout" data-options="fit:true">
	<div data-options="region:'north',border:false,title:'过滤条件'" style="height: 60px;overflow: hidden;" align="left">
		<form id="searchForm">
			<table class="tableForm datagrid-toolbar" style="width: 100%;height: 100%;">
				<tr>
					<!--  <th style="width:60px;">营业员</th>
					<td style="width:16px;"><input name=uusername style="width:110px;" /></td> -->
					<th style="width:60px;">所属仓库</th>
					<td style="width:16px;"><input name="rid" style="width: 110px;" /></td>
					<th style="width:60px;">开始时间</th>
					<td style="width:16px;"> 					  
					<input id="d4311" name="beginDate" class="easyui-validatebox" data-options="required:'true',missingMessage:'请选择销售时间'" style="width: 110px;" onClick="WdatePicker()" onFocus="WdatePicker({maxDate:'#F{$dp.$D(\'d4312\')||\'2030-10-01\'}'})"/></td>
					<th style="width:60px;">结束时间</th>
					<td style="width:16px;">					 
					<input id="d4312" name="endDate"   class="easyui-validatebox" data-options="required:'true',missingMessage:'请选择销售时间'" style="width: 110px;" onClick="WdatePicker()" onFocus="WdatePicker({minDate:'#F{$dp.$D(\'d4311\')}',maxDate:'2030-10-01'})"/></td>
					
					<td><a href="javascript:void(0);" class="easyui-linkbutton" onclick="_search();">查询</a><a href="javascript:void(0);" class="easyui-linkbutton" onclick="cleanSearch();">清空</a></td>
				</tr>
			</table>
		</form>
	</div>
	<div data-options="region:'center',border:false" style="overflow: hidden;">
		<table id="datagrid"></table>
	</div>
	
</body>

</html>